package main

import (
	"fmt"
	"gorm-study/src/pkg/student/models"
	"gorm-study/src/pkg/utils/dbutil"
)

func main() {
	var students []models.Student
	params := models.Student{
		Age:    24,
		Gender: false,
	}
	result := dbutil.DB.Where("age = ? and gender = ?", params.Age, params.Gender).Find(&students) // 传指针

	fmt.Printf("result.RowsAffected：%v \n", result.RowsAffected)
	for _, student := range students {
		fmt.Printf("Name:%v, Age:%v, Gender:%v \n", student.Name, student.Age, student.Gender)
	}
}
